package com.hkx.smipleemps.service;

import com.hkx.smipleemps.common.domain.Employee;
import com.hkx.smipleemps.common.utils.HibernateUtils;
import com.hkx.smipleemps.common.utils.PageInfo;
import com.hkx.smipleemps.dao.EmployeeDao;
import com.hkx.smipleemps.dao.EmployeeDaoImpl;
import org.hibernate.Query;
import org.hibernate.Session;

import java.util.List;

public class EmployeeServiceImpl implements EmployeeService {
    EmployeeDao employeeDao = new EmployeeDaoImpl();
    public void addEmployee(Employee employee) {
        employeeDao.addEmployee(employee);
    }

    @Override
    public PageInfo<Employee> findEmployees(int pageNo,int pageSize) {
        return employeeDao.selectEmployeesPage(pageNo,pageSize);
    }

    @Override
    public void removeEmployee(int id) {
       employeeDao.deleteEmployee(id);
    }

    @Override
    public Employee getEmployeeById(int id) {
        return employeeDao.selectEmployeeById(id);
    }
}
